<?php
//简单管理页面范例，在你的管理页面引用coresection/checkA.php就OK，当然，不要忘了添加注销登录的链接
include_once '../coresection/checkA.php';
?>



<?
if(isset($_REQUEST['now_extender']))
{
    $system_part = $_REQUEST ['now_extender'];
}

if(isset($_REQUEST['nowpageid']))
{
    $nowpageid = $_REQUEST['nowpageid'];
}

if(isset($_REQUEST['sortby']))
{
    $sortby = $_REQUEST['sortby'];
}

if(isset($_REQUEST['term_nid']))
{
    $term_nid = $_REQUEST['term_nid'];
}

?>

<?php 

include_once("language.php");//属性名字
?>

<?
include_once("../../config_controller.php");
$host = $_SERVER['HTTP_HOST']; //取得进入所输入的域名
$theme_folder = host_theme($host);

include_once '../../front/'.$theme_folder.'/connection.php';
include_once '../coresection/check_session.php';;
?>

<?php include_once("function.php"); ?>
<?php include "../../front/".$theme_folder."/config.php"; ?>

<?php include_once("../coresection/site-function.php"); ?>
<?php include_once("term-select-list-function.php"); ?>
<?php include_once("brand-select-list-function.php"); ?>


<?php
//20190717 需要在此页面统一检查当前表格的完整性，然后去更新插入新的项，保证系统的统一性。



?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once('../module/head.php'); ?>



    <script type="text/jscript" src="../../js/js.js"></script>
    <script src="/application/laydate/laydate.js"></script>

    <!--kindeditor编辑器-->
    <link rel="stylesheet" href="../../keditor/themes/default/default.css"/>
    <script charset="utf-8" src="../../keditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="../../keditor/lang/zh_CN.js"></script>


    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="detail_detail"]', {
                allowFileManager:true,
				afterBlur: function () { editor.sync(); },
				 allowFileManager: true,
				 filterMode : false
            });

        });
        KindEditor.ready(function (K) {
            editor2 = K.create('textarea[name="detail_detail2"]', {
                allowFileManager:true,
				afterBlur: function () { editor.sync(); },
				 allowFileManager: true,
				 filterMode : false
            });

        });
        KindEditor.ready(function (K) {
            editor3 = K.create('textarea[name="detail_detail3"]', {
                allowFileManager:true,
				afterBlur: function () { editor.sync(); },
				 allowFileManager: true,
				 filterMode : false
            });

        });
		
		 KindEditor.ready(function (K) {
            editor_in1 = K.create('textarea[name="detail_introduce"]', {
                allowFileManager: true,
				filterMode : false
            });

        });
        KindEditor.ready(function (K) {
            editor_in2 = K.create('textarea[name="detail_introduce2"]', {
                allowFileManager: true,
				filterMode : false
            });

        });
        KindEditor.ready(function (K) {
            editor_in3 = K.create('textarea[name="detail_introduce3"]', {
                allowFileManager: true,
				filterMode : false
            });

        });


    </script>
    <!--kindeditor编辑器-->


    <style>
        .layui-input-block {
            margin-left: 130px;
        }

        .layui-form-label {

            width: 100px;
        }

    </style>


</head>

<body>

<div id="topbar">
    <!--TopBar端點01-->
    <?php include '../module/topbar.php'; ?>
    <!--TopBar端點02-->
</div>

<div id="container">
<!--Container端點01-->
<div id="maincontent"   class="detail">
<!--maincontent端點01-->

<div id="sidebar">
    <?php include '../module/sidebar.php'; ?>
</div>



<div id="content">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend><h1>添加<? echo $sys_title ?> 资料</h1></legend>
    </fieldset>




<div class="detail-box layui-form <? echo $system_part ?>">
<div class="detail-boxes">
<ul class="detail-boxing">

<form id="detail_form"
      name="uploadfile"
      method="post"
      onsubmit="return checkRequired(detail_name);"
      action="../detail-add-function.php?now_extender=<? echo $system_part ?>"
      enctype="multipart/form-data"
      class="layui-form-pane">



    <fieldset class="layui-elem-field layui-field-title" id="content1" style="margin-top: 30px;">
        <legend>基本信息</legend>
    </fieldset>
    <blockquote class="layui-elem-quote">基本信息多数是对外使用的资料，请细心填写。</blockquote>
    <br/>



    <li class="layui-form-item name">
        <label class="layui-form-label">名称：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input"  name="detail_name"  >
        </div>
        <em class="explain">(<u
                style="color:red">*必填项目</u>,
            填写标题)
        </em>
    </li>

	<li class="layui-form-item en_name">
       <label class="layui-form-label">英文名称：</label>
      <div class="layui-input-block"> <input type="text" class="layui-input" name="detail_en_name" size="20" ></div>

    </li>
    
    <li class="layui-form-item short_desc">
        <label class="layui-form-label">短简介：</label>
        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_short_desc" size="20" ></div>
        <em class="explain">(填写短简介)</em>
    </li>

    <li class="layui-form-item model">
        <label class="layui-form-label">型号：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input"  class="layui-input"  name="detail_model" size="20" >
        </div>
        <em class="explain">填写您自己设置的型号，型号不作排序</em>
    </li>


<?php 
	$sql = "select count(*) as term_count from ".$table_Prefix."term  where publish = 1 and belong = '".$system_part."' ";
			
	$term_res = mysql_query($sql);
			
	$term_count = mysql_fetch_assoc($term_res);	
	
?>


<li class="layui-form-item term">
<label class="layui-form-label">所属分类：


</label>
	<div class="layui-input-block">
    <?php 
	if($term_count['term_count'] == 0){
	?>
    <a href="../../detail/term-add.php?now_extender=<?php echo $system_part;?>" class="threeDbtn layui-btn ">添加分类</a>
    <?php
	}
	else{
	?>
    <ul style="float:left;"><? include("mod-term-select.php");?></ul>
    <em class="explain">(选择对应的分类，可多选。)</em>
    <?php 
	}
	?>
	</div>
</li>

<?php 
	$sql = "select count(*) as brand_count from ".$table_Prefix."term  where publish = 1 and belong = 'brand' ";
			
	$brand_res = mysql_query($sql);
			
	$brand_count = mysql_fetch_assoc($brand_res);	
	
?>
<li class="layui-form-item brand">
<label class="layui-form-label">所属品牌：


</label>
	<div class="layui-input-block">
    <?php 
	if($brand_count['brand_count'] == 0){
	?>
    <a href="../../brand/term-add.php?now_extender=brand" class="threeDbtn layui-btn ">添加品牌</a>
    <?php
	}
	else{
	?>       
    <ul style="float:left;"><? include("mod-brand-select.php");?></ul>
    <em class="explain">(选择对应的分类，可多选。)</em>
    <?php 
	}
	?>
	</div>
</li>


    <li class="layui-form-item introduce">
        <label class="layui-form-label">简介：</label>
        <div class="layui-input-block">
            <textarea id="detail_introduce" cols="20" name="detail_introduce" ></textarea>
        </div>

        <em class="explain">(填写本文的概述)</em>
    </li>
    
    <li class="layui-form-item introduce2" style="display:none">
        <label class="layui-form-label">简介2：</label>
        
        <div class="layui-input-block">
            <textarea id="detail_introduce2" cols="20" name="detail_introduce2" ></textarea>
        </div>
      	<em class="explain">(填写本文的概述)</em>
    </li>
    
     <li class="layui-form-item introduce3" style="display:none">
        <label class="layui-form-label">简介3：</label>
        
        <div class="layui-input-block">
            <textarea id="detail_introduce3" cols="20" name="detail_introduce3" ></textarea>
        </div>
      	<em class="explain">(填写本文的概述)</em>
    </li>
    

    <? include("mod-images-upload.php");?>

    <li class="layui-form-item detail">
        <label class="layui-form-label">资料详情：</label>
		<div class="layui-input-block">
    <textarea name="detail_detail" style="width:1000px;height:400px;visibility:hidden;">
        <? echo  $detail['detail'] ?>
    </textarea>
     	</div>
        <em class="explain">(填写详细页面文字、图片等主体内容)</em>
    </li>




    <div class="layui-form-item detail2" style="display:none">
        <label class="layui-form-label"><?php echo $$detail_name2 ? $$detail_name2 : ''?>资料详情<?php echo $$detail_name2 ? '' : '2'?>：</label>
        <div class="layui-input-block">
    <textarea name="detail_detail2" style="width:800px;height:400px;visibility:hidden;">
    </textarea></div><em class="explain">(填写<?php echo $$detail_name2 ? $$detail_name2 : ''?>详细页面文字、图片等主体内容)</em>
    </div>


    <div class="layui-form-item detail3" style="display:none">
        <label class="layui-form-label"><?php echo $$detail_name3 ? $$detail_name3 : ''?>资料详情<?php echo $$detail_name2 ? '' : '3'?>：</label>
        <div class="layui-input-block">
    <textarea name="detail_detail3" style="width:800px;height:400px;visibility:hidden;">
    </textarea></div><em class="explain">(填写<?php echo $$detail_name3 ? $$detail_name3 : ''?>详细页面文字、图片等主体内容)</em>
    </div>





    <fieldset class="layui-elem-field layui-field-title" id="content2" style="margin-top: 60px;">
        <legend>SEO(搜索引擎优化)相关设置</legend>

    </fieldset>
    <blockquote class="layui-elem-quote">优质的SEO信息会使网站适合搜索引擎检索原则并且对用户更友好，从而更容易被搜索引擎收录及优先排序。</blockquote>



    <li class="layui-form-item title">
        <label class="layui-form-label">网页用标题：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input"  name="detail_title" size="20">
        </div>
        <em class="explain">(填写浏览器标签页显示的本页名称)</em></li>


    <li class="layui-form-item description"><label class="layui-form-label">网页用描述：</label>

        <div class="layui-input-block">
            <input type="text" class="layui-input"
                   name="detail_description" ></div><em class="explain">(填写本页描述性文字，用于搜索引擎的搜索结果显示)</em>
    </li>
    <li class="layui-form-item keyword"><label class="layui-form-label">网页用关键词：</label>

        <div class="layui-input-block">
            <input type="text" class="layui-input"  name="detail_keyword" >  </div><em
            class="explain">(填写本页的关键词，利于搜索引擎抓取)</em>
    </li>
    <li class="layui-form-item url"><label class="layui-form-label">网页地址：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" class="layui-input" name="detail_url"
                                              size="20" ></div><em class="explain">(填写本页前台网址，用于伪静态设置，利于搜索引擎抓取)</em>
    </li>




    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;" id="content3">
        <legend>更多资料</legend>
    </fieldset>
    <br/>


	


    <li class="layui-form-item mid">
        <label class="layui-form-label">人工编号：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input"  class="layui-input" name="detail_mid"   >
        </div>
        <em class="explain">(填写您自己设置的编号，人工编号不作排序)</em>
    </li>
	
    <li class="layui-form-item map_address" style=" display:none;">
        <label class="layui-form-label">地图地址：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" class="layui-input"
                                              name="detail_map_address" size="20" >
        </div>
        <em class="explain">填写地图的分享地址</em>
    </li>

    <li class="layui-form-item video_link" style=" display:none;">
        <label class="layui-form-label">视频地址：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" class="layui-input"
                                              name="detail_video" size="20" >
        </div>
        <em class="explain">填写在线视频站的分享地址</em>
    </li>









    <li class="layui-form-item video"  >
        <label class="layui-form-label" >视频上传1：</label>
        <div class="layui-input-block">
            <input type="file" id="upload_video" />
            <button type="button" class="layui-btn" id="UploadAction" >上传视频</button>
            <div class="layui-progress" style="margin:10px 0;" lay-filter="progress" lay-showPercent="true" id="prouploadfile">
                <div class="layui-progress-bar" lay-percent="0%"></div>
            </div>

            <video id="video" src="" controls="controls" width="100" height="100"> 您的浏览器不支持 video 标签。 </video>

        </div>

        <input type="hidden" name="detail_video_path" class="video_path"  />

        <input type="hidden" id="duration" name="detail_video_time"  />
        <input type="hidden" id="video_img" name="detail_video_img" />

        <em class="explain">视频上传中，请勿刷新或者提交</em>
    </li>



    <li class="layui-form-item video2" >
        <label class="layui-form-label" >视频上传2：</label>
        <div class="layui-input-block">
            <input type="file" id="upload_video2"  />
            <button type="button" class="layui-btn" id="UploadAction2" >上传视频</button>
            <div class="layui-progress" style="margin:10px 0;" lay-filter="progress2" lay-showPercent="true" id="prouploadfile2">
                <div class="layui-progress-bar" lay-percent="0%"></div>
            </div>

            <video id="video2" src="" controls="controls" width="100" height="100"> 您的浏览器不支持 video 标签。 </video>

        </div>

        <input type="hidden" name="detail_video_path2" class="video_path2"  />

        <input type="hidden" id="duration2" name="detail_video_time2"  />
        <input type="hidden" id="video_img2" name="detail_video_img2" />

        <em class="explain">视频上传中，请勿刷新或者提交</em>
    </li>


















    <li class="layui-form-item stock">
        <label class="layui-form-label">库存：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_stock" size="20"
                                              onkeyup="checknum( detail_stock);" onfocus="checkdefault( detail_stock)"
                                              onblur="checkempty( detail_stock)">
        </div><em class="explain">(填写产品库存量，默认为0，如没有库存，请输入0)</em>
    </li>
    <li class="layui-form-item price">
        <label class="layui-form-label">价格：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_price" size="20"
                                              onkeyup="checknum( detail_price);" onfocus="checkdefault(detail_price)"
                                              onblur="checkempty( detail_price)"></div><em class="explain">(填写产品价格，默认为0，如没有价格，请输入0)</em>
    </li>
    <li class="layui-form-item memberprice"><label class="layui-form-label">会员价格：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_memberprice" size="20"
                                              onkeyup="checknum(detail_memberprice);"
                                              onfocus="checkdefault(detail_memberprice);"
                                              onblur="checkempty(detail_memberprice)"></div><em class="explain">(填写产品的会员优惠价格，默认为0，如没有会员价格，请输入0)</em>
    </li>
    <li class="layui-form-item discountprice"><label class="layui-form-label">折购价格：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_discountprice" size="20"
                                              onkeyup="checknum(detail_discountprice);"
                                              onfocus="checkdefault(detail_discountprice)"
                                              onblur="checkempty(detail_discountprice)"></div><em class="explain">(填写产品的折购价格，默认为0，如没有会员价格，请输入0)</em>
    </li>




    <?//后期这部分，需要做成动态。在系统设置，有个select表格，专门用来读取这些系统用的select数据，方便后期可以更改?>
    <?//后期这部分，需要做成动态。在系统设置，有个select表格，专门用来读取这些系统用的select数据，方便后期可以更改?>
    <?//后期这部分，需要做成动态。在系统设置，有个select表格，专门用来读取这些系统用的select数据，方便后期可以更改?>
    <?//后期这部分，需要做成动态。在系统设置，有个select表格，专门用来读取这些系统用的select数据，方便后期可以更改?>
    <li class="layui-form-item danwei" style="display: none">
        <label class="layui-form-label">单位：</label>
        <div class="layui-input-block">
            <input name='ai_danwei' type='radio' value='对'  title="对" <?if($detail['danwei'] == '对'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='只'  title="只" <?if($detail['danwei'] == '只'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='台'  title="台" <?if($detail['danwei'] == '台'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='套'  title="套" <?if($detail['danwei'] == '套'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='条'  title="条" <?if($detail['danwei'] == '条'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='粒'  title="粒" <?if($detail['danwei'] == '粒'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='米'  title="米" <?if($detail['danwei'] == '米'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='个'  title="个" <?if($detail['danwei'] == '个'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='层'  title="层" <?if($detail['danwei'] == '层'){echo "checked='checked'";}?>/>
            <input name='ai_danwei' type='radio' value='件'  title="件" <?if($detail['danwei'] == '件'){echo "checked='checked'";}?>/>
        </div>

    </li>







    <li class="layui-form-item local">
        <label class="layui-form-label">产地：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_local" size="20"></div><em class="explain">(填写产品产地信息，如没有相关信息，请留空)</em>
    </li>
    <li class="layui-form-item listorder">
        <label class="layui-form-label">列表排序：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_listorder" size="20"
                                              onkeydown="onlyNum();" onfocus="checkdefault(detail_listorder)"
                                              onblur="checkempty(detail_listorder)"></div><em class="explain">(填写本文在所属前台列表下的列表排序，数字越大，排序越靠前)</em>
    </li>
    
    <li class="layui-form-item neworder" style=" display:none;">
                <label class="layui-form-label">新品排序：</label>
                <div class="layui-input-block">
                      <input type="text" class="layui-input" name="detail_neworder" size="20"
                                              onkeydown="onlyNum();" onfocus="checkdefault(detail_neworder)"
                                              onblur="checkempty(detail_neworder)">
                    </div>
                <em class="explain">(填写本文在所属前台列表下的列表排序，数字越大，排序越靠前)</em> </li>

    <li class="layui-form-item termorder">
        <label class="layui-form-label">分类排序：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="termorder" size="20"
                                              onkeydown="onlyNum();" onfocus="checkdefault(termorder)"
                                              onblur="checkempty(termorder)"></div><em class="explain">(填写在其对应分类中的排序，数字越大，排序越靠前)</em>
    </li>










    <li class="layui-form-item hotsale">
        <label class="layui-form-label">热销状态：</label>

        <div class="layui-input-block">
            <input name='detail_hotsale' type='radio' value='1'  title="标记热销" />
            <input name='detail_hotsale' type='radio' value='0'  title="取消热销" checked='checked'/>
        </div>
        <em class="explain">(可标记热销产品，将在前台添加热销产品标识或显示热销产品分类)</em>

    </li>




    <li class="layui-form-item discount">
        <label class="layui-form-label">折扣状态：</label>

        <div class="layui-input-block">
            <input name='detail_discount' type='radio' value='1'  title="标记折扣" />
            <input name='detail_discount' type='radio' value='0' title="取消折扣" checked='checked'/>
        </div>
        <em class="explain">(可标记折扣优惠产品，将在前台添加优惠产品标识或显示优惠产品分类)</em>

    </li>






    <li class="layui-form-item recommend">
        <label class="layui-form-label">推荐状态：</label>

        <div class="layui-input-block">
            <input name='detail_recommend' type='radio' value='1'  title="标记推荐" />
            <input name='detail_recommend' type='radio' value='0'  title="取消推荐" checked='checked'/>
        </div>
        <em class="explain">(可标记上架推荐产品，将在前台添加推荐产品标识或显示推荐产品分类)</em>

    </li>








    <li class="layui-form-item soldout">
        <label class="layui-form-label">下架状态：</label>

        <div class="layui-input-block">
            <input name='detail_soldout' type='radio' value='1'  title="标记下架" />
            <input name='detail_soldout' type='radio' value='0'  title="取消下架" checked='checked' />
        </div>
        <em class="explain">(可标记产品的下架状态，将在前台添加已下架标识或显示无货产品分类)</em>
    </li>





    <li class="layui-form-item publish">
        <label class="layui-form-label">发布状态：</label>

        <div class="layui-input-block">
            <input name='detail_publish' type='radio' value='1'  title="立即发布" checked='checked'/>
            <input name='detail_publish' type='radio' value='0'  title="暂未发布" />
        </div>
        <em class="explain">(选择立即发布，以上信息才能在前台显示；选择暂未发布，只对以上信息进行保存，不在前台显示)</em>
    </li>




    <li class="layui-form-item link"><label class="layui-form-label">链接地址：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_link" size="20"></div><em class="explain">(填写用于前台直接跳转的文章链接，类似于转载文章，默认留空)</em>
    </li>

    <li class="layui-form-item storage"><label class="layui-form-label">外链地址：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_storage" size="20"></div><em class="explain">(用于网站空间爆满时调用其他空间图片、附件的链接，默认留空)</em>
    </li>



    <li class="layui-form-item mark">
        <label class="layui-form-label">标记状态：</label>

        <div class="layui-input-block">
            <input name='detail_mark' type='radio' value='1'  title="添加标记" />
            <input name='detail_mark' type='radio' value='0'  title="取消标记" checked='checked'/>
        </div>
        <em class="explain">(选择添加标记，以上信息将在前台首页显示；选择取消标记，以上信息不在前台首页显示)</em>
    </li>




    <li class="layui-form-item vip">
        <label class="layui-form-label">权限设置：</label>

        <div class="layui-input-block">
            <input name='detail_vip' type='radio' value='1'  title="游客可见" />
            <input name='detail_vip' type='radio' value='0'  title="vip1可见"/>
            <input name='detail_vip' type='radio' value='0'  title="vip2可见" />
        </div>
        <em class="explain">(设置会员可浏览的权限)</em>
    </li>



    <li class="layui-form-item markorder"><label class="layui-form-label">标记排序：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_markorder" size="20" onkeydown="onlyNum();"
                                              onfocus="checkdefault(detail_markorder)"
                                              onblur="checkempty(detail_markorder)"></div><em class="explain">(填写在已标记分类中的排序，数字越大，排序越靠前)</em>
    </li>

    <li class="layui-form-item clickrate"><label class="layui-form-label">点击次数：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_clickrate" size="20" onkeydown="onlyNum();"
                                              onfocus="checkdefault(detail_clickrate)"
                                              onblur="checkempty(detail_clickrate)"></div><em class="explain">(显示在前台被浏览点击的次数，亦可在由后台管理员自行设置数量)</em>
    </li>


<?//假的点击量?>
<!--    <li class="layui-form-item clickrate_fake"><label class="layui-form-label">点击次数：</label>-->
<!---->
<!--        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_clickrate" size="20" onkeydown="onlyNum();"-->
<!--                                              onfocus="checkdefault(detail_clickrate)"-->
<!--                                              onblur="checkempty(detail_clickrate)"></div><em class="explain">(显示在前台被浏览点击的次数，亦可在由后台管理员自行设置数量)</em>-->
<!--    </li>-->




    <li class="layui-form-item onsaletime"><label class="layui-form-label">上架时间：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_onsaletime" size="20"
                                              onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                                              class="laydate-icon"></div><em class="explain">(填写上架的时间)</em>
    </li>


    <li class="layui-form-item modifytime"><label class="layui-form-label">修改时间：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_modifytime" size="20"
                                              onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                                              class="laydate-icon"></div><em class="explain">(填写修改的时间)</em>
    </li>
    <li class="layui-form-item inputtime" ><label class="layui-form-label">发布时间：</label>

        <div class="layui-input-block"><input type="text" class="layui-input" name="detail_inputtime" size="20"
                                              onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                                              class="laydate-icon"></div><em class="explain">(填写发布的时间)</em>
    </li>
	
    <li class="layui-form-item is_disabled">
        <label class="layui-form-label">禁止删除：</label>

        <div class="layui-input-block">
                <input name='ai_is_disabled' type='radio' value='1'  title="禁止删除" />
                <input name='ai_is_disabled' type='radio' value='0'  title="允许删除" checked='checked'/>
            </div>
 			<em class="explain">(如标记了禁止删除，列表页下面不能删除当前信息)</em>

    </li>
	
    <div class="more_link" style="display:none">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;" id="content4">
            <legend>关联板块</legend>
        </fieldset>
        <br/>
    
    
        <div class="">
                      <?php 
                      $type_list  = select_lines_all_items($table=$table_Prefix.'plate','nid desc'," link_menu = 1 " )
                      ?>
                      <div class="layui-form-item">
                        <label class="layui-form-label">搜索关联文章类型</label>
                        <div class="layui-input-block">
                          <?php foreach($type_list as $val){?>
                          <input name="article_type[]" value="<?php echo $val['mid']?>" title="<?php echo $val['name']?>" type="checkbox">
                          <?php }?>
                          <br />
                          <br />
                          <div class="layui-btn layui-btn-sm layui-btn-warm search_btn">搜索相关内容</div> 
                        </div>
                        
                      </div>
                      
                      <div style="position:relative;">
    
                            <div id="test4" class="demo-transfer"></div>
                          	<div class="buttonDiv">
                            <button type="button" class="layui-btn layui-btnUpDownmax upMaxBtn" onclick="moveUpMax('test4')"> 
                                <i class="layui-icon">&#xe619;</i>
                                <i class="layui-icon">&#xe619;</i>
                            </button>
                            <button type="button" class="layui-btn layui-btnUpDown upBtn" onclick="moveUp('test4')"> 
                                <i class="layui-icon">&#xe619;</i>
                            </button>
                            <button type="button" class="layui-btn layui-btnUpDown downBtn" onclick="moveDown('test4')">
                                <i class="layui-icon">&#xe61a;</i>
                            </button>
                            <button type="button" class="layui-btn layui-btnUpDownmax downMaxBtn" onclick="moveDownMax('test4')">
                                <i class="layui-icon">&#xe61a;</i>
                                <i class="layui-icon">&#xe61a;</i>
                            </button>
                            
                        </div>
                      </div>
                </div>
	</div>
	 <hr/>
     
     <div class="attr_box" style=" display:none">
     	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;" id="content4">
            <legend>产品属性</legend>
        </fieldset>
        <br/>
     	<table width="100%" id="gallery-table" align="center">
          
          <tr>
            <td>
              <a href="javascript:;" onclick="addImg(this)">[+]</a>
               图片标题  <input type="text" name="img_title[]" size="20" />
               图片描述  <input type="text" name="img_desc[]" size="20" />
               上传图片  <input type="file" name="img_url[]" />
               图片价格  <input type="text"  style="color:#aaa;" name="img_price[]"/>
            </td>
          </tr>
          
        </table>
     </div>
     
    <div class="function">
    	<input type="hidden" name="detail_attr" id="detail_attr" />
        <input type="hidden" name="cat_list_json" id="cat_list_json" />
        <input type="hidden" name="brand_list_json" id="brand_list_json" />
        
        <button class="layui-btn "  lay-submit type="button" lay-filter="formSub">立即提交</button>
        <input type="reset" class="layui-btn" value="重置"/>
		
        <input name="now_extender" type="hidden" value="<? echo $system_part ?>"/>
        <input name="nowpageid" type="hidden" value="<? echo $_REQUEST['nowpageid'] ?>"/>
        <input name="sortby" type="hidden" value="<? echo $_REQUEST['sortby'] ?>"/>
        <input name="term_nid" type="hidden" value="<? echo $_REQUEST['term_nid'] ?>"/>


        <a 	class="layui-btn layui-btn-normal" href="#content1" style="margin-left: 35px">基本信息</a>
        <a 	class="layui-btn layui-btn-normal" href="#content2">SEO设置</a>
        <a 	class="layui-btn layui-btn-normal" href="#content3">更多资料</a>
        <a 	class="layui-btn layui-btn-normal more_link" href="#content4" style="display:none">关联板块</a>

        <a href="javascript:;" class="layui-btn layui-bg-red layui-icon layui-icon-top go_top"></a>
    </div>


</form>
</ul>
</div>
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>



<script>
    var filePath_ = "/uploadfiles/" + "<?php echo $theme_folder?>" + "/";
    var videoUploadSwitch_ = false;
var Browser = new Object();

Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument != 'undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox") != - 1);
Browser.isSafari = (navigator.userAgent.toLowerCase().indexOf("safari") != - 1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != - 1);


 function addImg(obj)
  {
      var src  = obj.parentNode.parentNode;
      var idx  = rowindex(src);
      var tbl  = document.getElementById('gallery-table');
      var row  = tbl.insertRow(idx + 1);
      var cell = row.insertCell(-1);
      cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");
  }

  /**
   * 鍒犻櫎鍥剧墖涓婁紶
   */
  function removeImg(obj)
  {
      var row = rowindex(obj.parentNode.parentNode);
      var tbl = document.getElementById('gallery-table');

      tbl.deleteRow(row);
  }
  
  function rowindex(tr)
{
  if (Browser.isIE)
  {
    return tr.rowIndex;
  }
  else
  {
    table = tr.parentNode.parentNode;
    for (i = 0; i < table.rows.length; i ++ )
    {
      if (table.rows[i] == tr)
      {
        return i;
      }
    }
  }
}

$('.search_btn').click(
	function(){
		
		/*$.each($("input[name='article_type[]']"), function(i,val){ 
			
			 alert(val.name);
			 alert(val.value);  
		});*/
		 search_val = '';
		 $.each($("input[name='article_type[]']:checked"),function(){
              select_val = $(this).val();
			  if(search_val.length > 0){
				 search_val=search_val+','+select_val;
			  }
			  else{
				 search_val=select_val;
			  }
        });  
		
			$.ajax({
			type:"POST",
			url:"ajax_search_detail.php?act=search_detail",
			dateType:"json",
			data:{"val":search_val},
			dataType:"json",
			beforeSend: function () {
				
				$('.search_btn').attr({ disabled: "disabled" });
				
			   index =  layer.msg('正在查询中，请稍等', {
				  icon: 16,
				  shade:true,
				  time:10000,
				  shade: [0.8, '#393D49']
				},function(){
					
				});
				
			
			 }, 
			success:function(data){				
				if(data.error == 1){
					
					var msg_box = layer.msg(data.message, {
					  icon: 5,
					  shade:true,
					  time:1000,
					  shade: [0.8, '#393D49']
					});
					//
				}	
				else{
					layui.use(['transfer', 'layer', 'util'], function(){
					  var $ = layui.$
					  ,transfer = layui.transfer
					  ,layer = layui.layer
					  ,util = layui.util;
					  
					   
					  //模拟数据
					  var data1 = data.content
					  
					   transfer.reload('detail_attr_list', {
						  data: data1
						});
						
					});
					
				}
			},
			complete: function (XHR, TS) {layer.close(index);    XHR = null ; $('.search_btn').removeAttr("disabled"); } ,
			
		})

	}
)





  
 layui.use(['transfer', 'layer', 'util', 'form', 'tree'], function(){
	  var $ = layui.$
	  ,transfer = layui.transfer
	  ,layer = layui.layer
	  ,util = layui.util
	  ,tree = layui.tree
	  ,form = layui.form;
	   
	
	var data1 = []  //显示搜索框
	transfer.render({
			elem: '#test4'
			,data: data1
			,title: ['全选', '全选']
			,showSearch: true
			,height:300
			,width:600
			,id: 'detail_attr_list'
	}) 
						
						
	  form.on('submit(formSub)', function(data){
		   
		  if($('#cat_list').length > 0){
			
			var checkData = tree.getChecked('cat_list');
			$('#cat_list_json').val(JSON.stringify(checkData))
		 }
		 
		 if($('#brand_list').length > 0){
		 	 var checkbrandData = tree.getChecked('brand_list');
			 $('#brand_list_json').val(JSON.stringify(checkbrandData))
		 }
		   
		   var ul = $("#test4").find("ul").eq(1);
			var input = $(ul).find("input");
			var saveArr = [];
			for(var i = 0; i < input.length; i++) {
				var inJson = {};
				
				inJson["title"] = input[i].title;
				inJson["value"] = input[i].value;
				saveArr.push(inJson);
			}
			json_data= JSON.stringify(saveArr)
		  
		  $('#detail_attr').val(json_data)
		  
			window.editor.sync();
		 	window.editor2.sync();
		 	window.editor3.sync();
		 	window.editor_in1.sync();
		 	window.editor_in2.sync();
			
		 	window.editor_in3.sync();
			
			$('.layui-form-pane').submit() 	
		
	  })
	  
	});

  
//上移
		function moveUp(dom) {
			//找到选中的li
			var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent(); 
			if(typeof(index[0]) == "undefined") {
				layer.msg("请选中后，再进行移位操作");
				return;
			}
			for(var i=0;i<index.length;i++){
				if(index.eq(i).index()!=0){
					 index.eq(i).prev().before(index.eq(i));
				}
			}   
					
		}
		
		//置顶
		function moveUpMax(dom) {
			//找到选中的li
			var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent(); 
			if(typeof(index[0]) == "undefined") {
				layer.msg("请选中后，再进行移位操作");
				return;
			}
			for(var i=index.length-1;i>=0;i--){
				do{
					index.eq(i).prev().before(index.eq(i));
				}while(index.eq(i).index()!=0)
			}       			
		}
		
		//下移
		function moveDown(dom) {
			//找到选中的li
			var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent(); 
			if(typeof(index[0]) == "undefined") {
				layer.msg("请选中后，再进行移位操作");
				return;
			}
			for(var i=index.length-1;i>=0;i--){
				if(index.eq(i).index()!=($("#"+dom+" ul li").length-1)){
					 index.eq(i).next().after(index.eq(i));
				}
			}       			
		}
		
		//置底
		function moveDownMax(dom) {
			//找到选中的li
			var index = $("#"+dom+" ul" ).eq(1).find('.layui-form-checked').parent(); 
			if(typeof(index[0]) == "undefined") {
				layer.msg("请选中后，再进行移位操作");
				return;
			}
			for(var i=0;i<index.length;i++){
				do{
					index.eq(i).next().after(index.eq(i));
				}while(index.eq(i).index()!=($("#"+dom+" ul").eq(1).find("li").length-1))
			}       			
		}

</script>



<script charset="utf-8" src="../upload_video.js"></script>
<script charset="utf-8" src="../upload_video2.js"></script>
<?php include ROOT_PATH_ . "/controller/module/footer.php"; ?>
</body>
</html>
